import requests
import app


class employeeAPI():


    def __init__(self):
        self.url_add_employee = app.base_url + "/api/sys/user"
        self.url_update_employee = app.base_url + "/api/sys/user/{}"
        self.url_get_employee = app.base_url + "/api/sys/user/{}"
        self.url_delete_employee = app.base_url + "/api/sys/user/{}"


    def add_employee(self, add_employee_data):
        print(app.header)
        return requests.post(url=self.url_add_employee, json=add_employee_data, headers=app.header)

    def update_employee(self, employee_id, update_data):
        url = self.url_update_employee.format(employee_id)
        return requests.put(url=url, json=update_data, headers=app.header)

    def get_employee(self, employee_id):
        url = self.url_update_employee.format(employee_id)
        return requests.get(url=url, headers=app.header)

    def delete_employee(self, employee_id):
        url = self.url_update_employee.format(employee_id)
        return  requests.delete(url=url, headers=app.header)


